#include <iostream>
#include <vector>

using namespace std;

class Solution
{
    const static int MOD = 1e9 + 7;

public:
    int waysToReachTarget(int target, vector<vector<int>> &types)
    {
        vector<int> dp(target + 1, 0);
        dp[0] = 1;
        for (auto type : types)
        {
            int amount = type[0], score = type[1];
            amount = min(amount, target / score);
            for (int i = target; i > 0; i--)
            {
                for (int j = 1; j <= i / score; j++)
                    dp[i] = (dp[i] + dp[i - j * score]) % MOD;
            }
        }
        return dp[target];
    }
};

int main()
{
    cout << "Code2585" << endl;
    Solution s;
    vector<vector<int>> types = {{6, 1}, {3, 2}, {2, 3}};
    cout << s.waysToReachTarget(6, types) << endl;
    return 0;
}